package com.shenmazong.servertalkadmin.controller;

import com.shenmazong.servertalkadmin.service.TbSellerFeeRecordService;
import com.shenmazong.servertalkadmin.service.TbSubjectService;
import com.shenmazong.utils.ResponseResult;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
@CrossOrigin
@Api(tags = "接口-销售提成记录提成记录表")
public class TbSellerFeeRecordController {
    @Autowired
    TbSellerFeeRecordService tbSellerFeeRecordService;

    /**
     * TODO 添加销售提成记录
     * @Description:
     * @Author: 王晓文
     * @Date: 2020/9/9 10:34
     * @return: java.lang.ResponseResult
     **/
    @PostMapping("/addTbSellerFeeRecord")
    @ApiOperation(value = "添加销售提成记录", notes = "管理员添加销售提成记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name="sellerId", value = "销售Id", dataType = "int", required=true, example = "0"),
            @ApiImplicitParam(name="teacherId", value = "教师Id", dataType = "int", required=true, example = "0"),
            @ApiImplicitParam(name="studentId", value = "学生Id", dataType = "int", required=true, example = "0"),
            @ApiImplicitParam(name="classId", value = "课程Id", dataType = "int", required=true, example = "0"),
            @ApiImplicitParam(name="changeFee", value = "提成金额", dataType = "long", required=true, example = "0"),
            @ApiImplicitParam(name="changeReason", value = "记录描述", dataType = "String", required=true)
    })
    public ResponseResult addTbSellerFeeRecord(@RequestParam("sellerId") Integer sellerId,
                                        @RequestParam("teacherId") Integer teacherId,
                                        @RequestParam("studentId") Integer studentId,
                                        @RequestParam("classId") Integer classId,
                                        @RequestParam("changeFee") Long changeFee,
                                               @RequestParam("changeReason") String changeReason){
        return tbSellerFeeRecordService.addTbSellerFeeRecord(sellerId,teacherId,studentId,classId,changeFee,changeReason);

    }
    /**
     * TODO 删除销售提成记录
     * @Description:
     * @Author: 王晓文
     * @Date: 2020/9/9 10:34
     * @return: java.lang.ResponseResult
     **/
    @PostMapping("/delTbSellerFeeRecord")
    @ApiOperation(value = "删除销售提成记录", notes = "管理员删除销售提成记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name="id", value = "删除的销售提成记录编号", dataType = "int", required=true, example = "0")
    })
    public ResponseResult delTbSellerFeeRecord(@RequestParam("id") Integer id){
        return tbSellerFeeRecordService.delTbSellerFeeRecord(id);

    }

    /**
     * @Description:查询所有销售记录
     * @Author: 王晓文
     * @Date: 2020/9/11 13:48
     * TODO getTbSellerFeeRecord 查询所有销售记录
     * @return: com.wdy.utils.ResponseResult
     **/
    @ApiOperation(value = "查询所有销售记录", notes = "查询所有销售记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name="pageCurrent", value = "分页", dataType = "int", required=true),
            @ApiImplicitParam(name="pageSize", value = "分页", dataType = "int", required=true)
    })
    @PostMapping("/getTbSellerFeeRecord")
    public ResponseResult getTbSellerFeeRecord(@RequestParam("pageCurrent") Integer pageCurrent,
                                               @RequestParam("pageSize") Integer pageSize){
        return tbSellerFeeRecordService.getTbSellerFeeRecord(pageCurrent,pageSize);
    }



}
